package cn.xyafu.service.impl;

import cn.xyafu.dao.LostDao;
import cn.xyafu.po.Lost;
import cn.xyafu.service.LostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;

@Service
@Transactional
public class LostServiceImpl implements LostService {
    @Autowired
    private LostDao lostDao;
    //查找所有失物
    @Override
    public List<Lost> findAllLost(HashMap<String,Object> map) {
        return this.lostDao.findAllLost(map);
    }
    //查询失物总数
    public Integer countLost(String keyWord){
        return this.lostDao.countLost(keyWord);
    }
    //查询失物总数（按类型)
    public Integer countLostByType(Integer tp){
        return this.lostDao.countLostByType(tp);
    }
    //按id查找
    @Override
    public Lost findByLid(Integer lid) {
        return this.lostDao.findByLid(lid);
    }
    //按类型查找
    @Override
    public List<Lost> findByType(HashMap<String,Object> map) {
        return this.lostDao.findByType(map);
    }
//    //关键字查找
//    @Override
//    public List<Lost> findByKeys(String lmsg) {
//        return this.lostDao.findByKeys(lmsg);
//    }
    //按用户id查找
    @Override
    public List<Lost> findByUid(Integer uid) {
        return this.lostDao.findByUid(uid);
    }
    //删除发布的失物信息
    @Override
    public Integer deleteByLost(Lost lost){
        return this.lostDao.deleteByLost(lost);
    }
    //添加失物信息
    @Override
    public Integer addByLost(Lost lost) {
        return this.lostDao.addByLost(lost);
    }
}
